<%--
  Created by IntelliJ IDEA.
  User: 梁玉杰
  Date: 2021/5/26
  Time: 19:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page isELIgnored="false" contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h1>您好，${user.trueName}欢迎回来</h1>
<h3><a href="${pageContext.request.contextPath}/listuser">我的信息</a></h3>
<h3><a href="${pageContext.request.contextPath}/listshops">我的店铺</a></h3>

<dic>
    <button onclick="test()">点我</button>
    <button onclick="test1()">点我1</button>
    <button onclick="test2()">点我2</button>
</dic>

<script type="text/javascript" src="${pageContext.request.contextPath}/libs/jquery/jquery-3.5.1.js"></script>
<script type="text/javascript">

    function test(){

        var cof =confirm("您确定要点我吗？");//弹窗提示
        if(cof){
            console.log("点我成功！");
            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath}/test",
                data:JSON.stringify({"pkId":5,"userId":55,"employeeNo":"bb555"}),
                // data:'{"pkId":5,"userId":55,"employeeNo":"bb555"}',
                contentType:"application/json;charset=utf-8",
                dataType:"json",
                success:function(data) {
                    alert("1111");
                    console.log("SUCCESS");
                    console.log("code::: " + data.code);
                    console.log("msg::: " + data.msg);
                },
                error:function (msg){
                    alert("请求错误！");
                }
            })
        }

    }
    var d = {
        "company_name": "北工商",
        "level": 99,
        "age": 18,
        "dept": [
            {
                "name": "张国立",
                "sex": "男",
                "email": "zhangguoli@123.com",
                "url": "./img/1.jpg"
            },
            {
                "name": "张铁林",
                "sex": "男",
                "email": "zhangtieli@123.com",
                "url": "./img/2.jpg"
            },
            {
                "name": "邓婕",
                "sex": "女",
                "email": "zhenjie@123.com",
                "url": "./img/3.jpg"
            },
            {
                "name": "张国立",
                "sex": "男",
                "email": "zhangguoli@123.com",
                "url": "./img/4.jpg"
            },
            {
                "name": "张铁林",
                "sex": "男",
                "email": "zhangtieli@123.com",
                "url": "./img/5.jpg"
            },
            {
                "name": "邓婕",
                "sex": "女",
                "email": "zhenjie@123.com",
                "url": "./img/6.jpg"
            }
        ]
    }
    function test1() {

        var cof1 =confirm("您确定要点我吗？");  //弹窗提示
        if(cof1){
            console.log("点我成功！！");
            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath}/test1",
                data:JSON.stringify(d),
                contentType:"application/json;charset=utf-8",
                dataType: "json",
                success:function (data){

                },
                error:function(msg){
                    alert("请求错误~！！");
                }
            })
        }
    }

   var qq= {
        "response": {
        "status": "SUCCESS",
            "data": {
                "mxRecords": [
                    {
                        "value": "us2.mx3.mailhostbox.com.",
                        "ttl": 1,
                        "priority": 100,
                        "hostName": "@"
                    },
                    {
                        "value": "us2.mx1.mailhostbox.com.",
                        "ttl": 1,
                        "priority": 100,
                        "hostName": "@"
                    },
                    {
                        "value": "us2.mx2.mailhostbox.com.",
                        "ttl": 1,
                        "priority": 100,
                        "hostName": "@"
                    }
                ],
                "cnameRecords": [
                    {
                        "aliasHost": "pop.a.co.uk.",
                        "canonicalHost": "us2.pop.mailhostbox.com."
                    },
                    {
                        "aliasHost": "webmail.a.co.uk.",
                        "canonicalHost": "us2.webmail.mailhostbox.com."
                    },
                    {
                        "aliasHost": "smtp.a.co.uk.",
                        "canonicalHost": "us2.smtp.mailhostbox.com."
                    },
                    {
                        "aliasHost": "imap.a.co.uk.",
                        "canonicalHost": "us2.imap.mailhostbox.com."
                    }
                ],
                "dkimTxtRecord": {
                    "domainname": "20a19._domainkey.a.co.uk",
                        "value": "\"v=DKIM1; g=*; k=rsa; p=DkfbhO8Oyy0E1WyUWwIDAQAB\"",
                        "ttl": 1
                },
                "spfTxtRecord": {
                    "domainname": "a.co.uk",
                        "value": "\"v=spf1 redirect=_spf.mailhostbox.com\"",
                        "ttl": 1
                },
                "loginUrl": "us2.cp.mailhostbox.com"
            }
        }
    }

    function test2(){
        var cof2 =confirm("您确定要点我吗？");  //弹窗提示
        if(cof2){
            console.log("点我成功！！");
            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath}/test2",
                data:JSON.stringify(qq),
                contentType:"application/json;charset=utf-8",
                dataType: "json",
                success:function (data){

                },
                error:function(msg){
                    alert("请求错误~！！");
                }
            })
        }
    }


</script>



</body>
</html>
